import request from '@/utils/request.js'

// 获取部门列表
export const getDepartments = () => request({
  url: '/company/department',
  method: 'GET'
})

// 新增部门
// axios, params 是在URL上传数据
//        data 是在请求体中传数据
export const addDepartments = data => request({
  url: '/company/department',
  method: 'POST',
  data
})

// 删除部门
export const delDepartments = id => request({
  url: `/company/department/${id}`,
  method: 'DELETE'
})

// 获取id的数据
export const getDepartmentsById = id => request({
  url: `/company/department/${id}`,
  method: 'GET'
})

// 修改数据 更新页面视图
export const updateDepartment = data => request({
  url: `/company/department/${data.id}`,
  method: 'PUT',
  data
})
